/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package yeswecanui;

import com.mysql.jdbc.Connection;
import java.awt.CardLayout;
import java.io.File;
import java.sql.SQLException;
import java.util.logging.Logger;
import java.util.logging.Level;
import javax.swing.JFileChooser;
import yeswecandb.YesWeCanDB;

/**
 *
 * @author Gguer887
 */

// Instead of Content, change to Textbook information? This is what students should be able to do:
/*
 •	A student is able to view a course's calendar.  >> Done, need to link Calendar with the Data Base.
•	A student is able to download a course's available material. >> Needs doing.
•	A student is able to view a course's assignment. >> Needs doing.
•	A student is able to view the name of other students in the course. >> Layout Done, need to link to the list of students on the data base.
•	A student is able to view their grades, should there be any. >> Layout done, need to link to the list of grades on the data base.
•	A student is able to submit assignments.  >> Needs doing. Also needs more information before layout can be safely done.
        A student is able to do a quiz or exam. >> How are those going to be done? Need more information before doing layout.

 */
public class StudentsCoursePage extends javax.swing.JFrame {

    
    private JFileChooser fc; 
    private YesWeCanDB newDB;
    
    public StudentsCoursePage() {
        initComponents();
    }

    private void initializeDatabase() 
    {
        try {
            newDB = new YesWeCanDB();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(StudentsCoursePage.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(StudentsCoursePage.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(StudentsCoursePage.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(StudentsCoursePage.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        assignmentDialog = new javax.swing.JDialog();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        panel1 = new java.awt.Panel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jButton8 = new javax.swing.JButton();
        assignmentDialogBackButton = new javax.swing.JButton();
        gradeDialog = new javax.swing.JDialog();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        gradeBackButton = new javax.swing.JButton();
        classListDialog = new javax.swing.JDialog();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        classListBackButton = new javax.swing.JButton();
        examDialog = new javax.swing.JDialog();
        examQuestionLabel = new javax.swing.JLabel();
        examQuestionPanel = new javax.swing.JPanel();
        examQuestionTextLabel = new javax.swing.JLabel();
        examAnswerPanel = new javax.swing.JPanel();
        gradeAnswer1Radio = new javax.swing.JRadioButton();
        gradeAnswer2Radio = new javax.swing.JRadioButton();
        gradeAnswer3Radio = new javax.swing.JRadioButton();
        gradeAnswer4Radio = new javax.swing.JRadioButton();
        gradeAnswer5Radio = new javax.swing.JRadioButton();
        examAnswerButton = new javax.swing.JButton();
        examBackButton = new javax.swing.JButton();
        jSpinner1 = new javax.swing.JSpinner();
        mainPanel = new javax.swing.JPanel();
        CoursePage = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jCalendar1 = new com.toedter.calendar.JCalendar();
        announcementsViewButton = new javax.swing.JButton();
        assignmentViewButton = new javax.swing.JButton();
        contentViewButton = new javax.swing.JButton();
        gradesViewButton = new javax.swing.JButton();
        examsViewButton = new javax.swing.JButton();
        classListViewButton = new javax.swing.JButton();
        Calendar = new javax.swing.JPanel();
        Assignments = new javax.swing.JPanel();
        assignmentPanelViewButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jLabel2 = new javax.swing.JLabel();

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel3.setText(" Assignment");

        jLabel4.setText("Content");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane2.setViewportView(jTextArea1);

        javax.swing.GroupLayout panel1Layout = new javax.swing.GroupLayout(panel1);
        panel1.setLayout(panel1Layout);
        panel1Layout.setHorizontalGroup(
            panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panel1Layout.setVerticalGroup(
            panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jButton8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jButton8.setText("Submit");

        assignmentDialogBackButton.setText("Browse");
        assignmentDialogBackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                assignmentDialogBackButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout assignmentDialogLayout = new javax.swing.GroupLayout(assignmentDialog.getContentPane());
        assignmentDialog.getContentPane().setLayout(assignmentDialogLayout);
        assignmentDialogLayout.setHorizontalGroup(
            assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(assignmentDialogLayout.createSequentialGroup()
                .addGroup(assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(assignmentDialogLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel4)
                                .addComponent(panel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(assignmentDialogLayout.createSequentialGroup()
                                .addComponent(assignmentDialogBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(assignmentDialogLayout.createSequentialGroup()
                        .addGap(89, 89, 89)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(26, Short.MAX_VALUE))
        );
        assignmentDialogLayout.setVerticalGroup(
            assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, assignmentDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(assignmentDialogLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 199, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, assignmentDialogLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(panel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 4, Short.MAX_VALUE)
                .addGroup(assignmentDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(assignmentDialogBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Item", "Date", "Grade"
            }
        ));
        jScrollPane3.setViewportView(jTable1);

        gradeBackButton.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        gradeBackButton.setText("Back");
        gradeBackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gradeBackButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout gradeDialogLayout = new javax.swing.GroupLayout(gradeDialog.getContentPane());
        gradeDialog.getContentPane().setLayout(gradeDialogLayout);
        gradeDialogLayout.setHorizontalGroup(
            gradeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, gradeDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(gradeDialogLayout.createSequentialGroup()
                .addGap(151, 151, 151)
                .addComponent(gradeBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(153, Short.MAX_VALUE))
        );
        gradeDialogLayout.setVerticalGroup(
            gradeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(gradeDialogLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(gradeBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6))
        );

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "First Name", "Last Name", "E-mail"
            }
        ));
        jScrollPane4.setViewportView(jTable2);

        classListBackButton.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        classListBackButton.setText("Back");
        classListBackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                classListBackButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout classListDialogLayout = new javax.swing.GroupLayout(classListDialog.getContentPane());
        classListDialog.getContentPane().setLayout(classListDialogLayout);
        classListDialogLayout.setHorizontalGroup(
            classListDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(classListDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(classListDialogLayout.createSequentialGroup()
                .addGap(144, 144, 144)
                .addComponent(classListBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(160, Short.MAX_VALUE))
        );
        classListDialogLayout.setVerticalGroup(
            classListDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(classListDialogLayout.createSequentialGroup()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(classListBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 9, Short.MAX_VALUE))
        );

        examQuestionLabel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        examQuestionLabel.setText("Question #");

        examQuestionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Question"));
        examQuestionPanel.setFocusable(false);
        examQuestionPanel.setMaximumSize(new java.awt.Dimension(498, 130));
        examQuestionPanel.setMinimumSize(new java.awt.Dimension(498, 130));
        examQuestionPanel.setPreferredSize(new java.awt.Dimension(498, 130));

        examQuestionTextLabel.setText("<html><body>This is a question example, it should show how the question is going to be<br> confined inside the 'Question' Panel. It is using HTML tags at the moment to wrap the text, though <br> that might be changed in the future.</body></html>");

        javax.swing.GroupLayout examQuestionPanelLayout = new javax.swing.GroupLayout(examQuestionPanel);
        examQuestionPanel.setLayout(examQuestionPanelLayout);
        examQuestionPanelLayout.setHorizontalGroup(
            examQuestionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(examQuestionPanelLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(examQuestionTextLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        examQuestionPanelLayout.setVerticalGroup(
            examQuestionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(examQuestionPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(examQuestionTextLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(54, Short.MAX_VALUE))
        );

        examQuestionTextLabel.getAccessibleContext().setAccessibleName("<html><body>This is a question example, it should show how the question is going to be<br> confined inside the 'Question' Panel. It is using HTML tags at the moment to wrap the text, though <br> that might be changed in the future.</body></html>");

        examAnswerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Answer"));

        gradeAnswer1Radio.setText("First Choice");

        gradeAnswer2Radio.setText("Second Choice");

        gradeAnswer3Radio.setText("Third Choice");

        gradeAnswer4Radio.setText("Fourth Choice");

        gradeAnswer5Radio.setText("Fifth Choice");

        javax.swing.GroupLayout examAnswerPanelLayout = new javax.swing.GroupLayout(examAnswerPanel);
        examAnswerPanel.setLayout(examAnswerPanelLayout);
        examAnswerPanelLayout.setHorizontalGroup(
            examAnswerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(examAnswerPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(examAnswerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(gradeAnswer1Radio)
                    .addComponent(gradeAnswer2Radio)
                    .addComponent(gradeAnswer3Radio)
                    .addComponent(gradeAnswer4Radio)
                    .addComponent(gradeAnswer5Radio))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        examAnswerPanelLayout.setVerticalGroup(
            examAnswerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(examAnswerPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(gradeAnswer1Radio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(gradeAnswer2Radio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(gradeAnswer3Radio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(gradeAnswer4Radio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(gradeAnswer5Radio)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        examAnswerButton.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        examAnswerButton.setText("Answer");

        examBackButton.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        examBackButton.setText("Back");
        examBackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                examBackButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout examDialogLayout = new javax.swing.GroupLayout(examDialog.getContentPane());
        examDialog.getContentPane().setLayout(examDialogLayout);
        examDialogLayout.setHorizontalGroup(
            examDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(examDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(examAnswerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(examDialogLayout.createSequentialGroup()
                .addGap(57, 57, 57)
                .addComponent(examAnswerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, Short.MAX_VALUE)
                .addComponent(examBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(74, 74, 74))
            .addGroup(examDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(examQuestionPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(examDialogLayout.createSequentialGroup()
                .addGap(200, 200, 200)
                .addComponent(examQuestionLabel)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        examDialogLayout.setVerticalGroup(
            examDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(examDialogLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(examQuestionLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(examDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(examDialogLayout.createSequentialGroup()
                        .addComponent(examQuestionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(examAnswerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(76, 76, 76))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, examDialogLayout.createSequentialGroup()
                        .addGap(326, 326, 326)
                        .addGroup(examDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(examBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(examAnswerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        mainPanel.setLayout(new java.awt.CardLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Class Name");

        announcementsViewButton.setText("Announcements");

        assignmentViewButton.setText("Assignments");
        assignmentViewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                assignmentViewButtonActionPerformed(evt);
            }
        });

        contentViewButton.setText("Content");

        gradesViewButton.setText("Grades");
        gradesViewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gradesViewButtonActionPerformed(evt);
            }
        });

        examsViewButton.setText("Exams");
        examsViewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                examsViewButtonActionPerformed(evt);
            }
        });

        classListViewButton.setText("View Class List");
        classListViewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                classListViewButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout CoursePageLayout = new javax.swing.GroupLayout(CoursePage);
        CoursePage.setLayout(CoursePageLayout);
        CoursePageLayout.setHorizontalGroup(
            CoursePageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CoursePageLayout.createSequentialGroup()
                .addGroup(CoursePageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CoursePageLayout.createSequentialGroup()
                        .addGap(280, 280, 280)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(CoursePageLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(CoursePageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(classListViewButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(announcementsViewButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(assignmentViewButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(contentViewButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(gradesViewButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(examsViewButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(118, 118, 118)
                        .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(151, Short.MAX_VALUE))
        );
        CoursePageLayout.setVerticalGroup(
            CoursePageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CoursePageLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(CoursePageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(CoursePageLayout.createSequentialGroup()
                        .addComponent(announcementsViewButton)
                        .addGap(18, 18, 18)
                        .addComponent(assignmentViewButton)
                        .addGap(18, 18, 18)
                        .addComponent(contentViewButton)
                        .addGap(18, 18, 18)
                        .addComponent(gradesViewButton)
                        .addGap(18, 18, 18)
                        .addComponent(examsViewButton)))
                .addGap(18, 18, 18)
                .addComponent(classListViewButton)
                .addContainerGap(50, Short.MAX_VALUE))
        );

        mainPanel.add(CoursePage, "card9");

        javax.swing.GroupLayout CalendarLayout = new javax.swing.GroupLayout(Calendar);
        Calendar.setLayout(CalendarLayout);
        CalendarLayout.setHorizontalGroup(
            CalendarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        CalendarLayout.setVerticalGroup(
            CalendarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        mainPanel.add(Calendar, "card4");

        assignmentPanelViewButton.setText("View Assignments");
        assignmentPanelViewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                assignmentPanelViewButtonActionPerformed(evt);
            }
        });

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jList1);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel2.setText("Assignments");

        javax.swing.GroupLayout AssignmentsLayout = new javax.swing.GroupLayout(Assignments);
        Assignments.setLayout(AssignmentsLayout);
        AssignmentsLayout.setHorizontalGroup(
            AssignmentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(AssignmentsLayout.createSequentialGroup()
                .addGap(74, 74, 74)
                .addComponent(assignmentPanelViewButton, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(132, 132, 132)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, AssignmentsLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2)
                .addGap(210, 210, 210))
        );
        AssignmentsLayout.setVerticalGroup(
            AssignmentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(AssignmentsLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(AssignmentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(assignmentPanelViewButton, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35))
        );

        mainPanel.add(Assignments, "card3");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void assignmentDialogBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assignmentDialogBackButtonActionPerformed
        fc = new JFileChooser();
        
        int returnVal = fc.showDialog(StudentsCoursePage.this,"Attach");
        
        if (returnVal == JFileChooser.APPROVE_OPTION){
                File file = fc.getSelectedFile();
        }
        fc.setSelectedFile(null);
        
    }//GEN-LAST:event_assignmentDialogBackButtonActionPerformed

    private void assignmentViewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assignmentViewButtonActionPerformed
        CardLayout layout = (CardLayout)mainPanel.getLayout();
        layout.show(mainPanel,"Assignments");
        setVisible(true); 
    }//GEN-LAST:event_assignmentViewButtonActionPerformed

    private void gradeBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gradeBackButtonActionPerformed
        gradeDialog.setVisible(false);
    }//GEN-LAST:event_gradeBackButtonActionPerformed

    private void gradesViewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gradesViewButtonActionPerformed
        gradeDialog.setVisible(true);
        gradeDialog.pack();
        //Needs code integration with DB.
    }//GEN-LAST:event_gradesViewButtonActionPerformed

    private void classListViewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classListViewButtonActionPerformed
        classListDialog.setVisible(true);
        classListDialog.pack();
        //Needs code integration with DB.
    }//GEN-LAST:event_classListViewButtonActionPerformed

    private void classListBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classListBackButtonActionPerformed
        classListDialog.setVisible(false);
    }//GEN-LAST:event_classListBackButtonActionPerformed

    private void assignmentPanelViewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assignmentPanelViewButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_assignmentPanelViewButtonActionPerformed

    private void examBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_examBackButtonActionPerformed
        examDialog.setVisible(false);
    }//GEN-LAST:event_examBackButtonActionPerformed

    private void examsViewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_examsViewButtonActionPerformed
        examDialog.setVisible(true);
        examDialog.pack();
        //Needs code integration with DB.
    }//GEN-LAST:event_examsViewButtonActionPerformed

    /* tested*/
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(StudentsCoursePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(StudentsCoursePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(StudentsCoursePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(StudentsCoursePage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new StudentsCoursePage().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Assignments;
    private javax.swing.JPanel Calendar;
    private javax.swing.JPanel CoursePage;
    private javax.swing.JButton announcementsViewButton;
    private javax.swing.JDialog assignmentDialog;
    private javax.swing.JButton assignmentDialogBackButton;
    private javax.swing.JButton assignmentPanelViewButton;
    private javax.swing.JButton assignmentViewButton;
    private javax.swing.JButton classListBackButton;
    private javax.swing.JDialog classListDialog;
    private javax.swing.JButton classListViewButton;
    private javax.swing.JButton contentViewButton;
    private javax.swing.JButton examAnswerButton;
    private javax.swing.JPanel examAnswerPanel;
    private javax.swing.JButton examBackButton;
    private javax.swing.JDialog examDialog;
    private javax.swing.JLabel examQuestionLabel;
    private javax.swing.JPanel examQuestionPanel;
    private javax.swing.JLabel examQuestionTextLabel;
    private javax.swing.JButton examsViewButton;
    private javax.swing.JRadioButton gradeAnswer1Radio;
    private javax.swing.JRadioButton gradeAnswer2Radio;
    private javax.swing.JRadioButton gradeAnswer3Radio;
    private javax.swing.JRadioButton gradeAnswer4Radio;
    private javax.swing.JRadioButton gradeAnswer5Radio;
    private javax.swing.JButton gradeBackButton;
    private javax.swing.JDialog gradeDialog;
    private javax.swing.JButton gradesViewButton;
    private javax.swing.JButton jButton8;
    private com.toedter.calendar.JCalendar jCalendar1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JSpinner jSpinner1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JPanel mainPanel;
    private java.awt.Panel panel1;
    // End of variables declaration//GEN-END:variables
}
